home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CUCD / Programming / OUI / rcs / rectangle.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  1.4 KB  |  85 lines

  1. head    1.2;
  2. access;
  3. symbols;
  4. locks
  5.     dlorre:1.2; strict;
  6. comment    @// @;
  7.  
  8.  
  9. 1.2
  10. date    97.07.14.04.23.26;    author dlorre;    state Exp;
  11. branches;
  12. next    1.1;
  13.  
  14. 1.1
  15. date    96.08.22.02.05.10;    author dlorre;    state Exp;
  16. branches;
  17. next    ;
  18.  
  19.  
  20. desc
  21. @Oui.lib -- Object User Interface
  22. Projet créé en 1994
  23. Auteur: Dominique Lorre
  24. @
  25.  
  26.  
  27. 1.2
  28. log
  29. @*** empty log message ***
  30. @
  31. text
  32. @// $Id$
  33. #include <clib/macros.h>
  34. #include "rectangle.h"
  35.  
  36. rectangle::rectangle(short l, short t, short w, short h)
  37. {
  38.     left = MAX(l, short(0)) ;
  39.     top = MAX(t, short(0)) ;
  40.     width = MAX(w, short(0));
  41.     height = MAX(h, short(0)) ;
  42.     minw = maxw = 0 ;
  43.     minh = maxh = 0 ;
  44. }
  45. void rectangle::box(short l, short t, short w, short h)
  46. {
  47.     left = l ;
  48.     top = t ;
  49.     width = w ;
  50.     height = h ;
  51.     if ((left+width) > maxw) maxw = short(left+width) ;
  52.     if ((top+height) > maxh) maxh = short(top+height) ;
  53. }
  54.  
  55. void rectangle::relbox(short dx, short dy, short dw, short dh)
  56. {
  57.     box(dx+left, dy+top, dw+width, dh+height) ;
  58. }
  59.  
  60. void rectangle::move(short dx, short dy) {
  61.     box(dx+left, dy+top, width, height) ;
  62. }
  63.  
  64.  
  65. void rectangle::size(short dw, short dh) {
  66.     box(left, top, dw+width, dh+height) ;
  67. }
  68.  
  69. void rectangle::limits(short wmin, short hmin, short wmax, short hmax) {
  70.     minw = MAX(wmin, short(0)) ;
  71.     minh = MAX(hmin, short(0)) ;
  72.     maxw = MAX(wmax, minw) ;
  73.     maxh = MAX(hmax, minh) ;
  74. }
  75. @
  76.  
  77.  
  78. 1.1
  79. log
  80. @Initial revision
  81. @
  82. text
  83. @d1 1
  84. @
  85.